home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
tex
/
lgrind.zoo
/
docstrip.tex
< prev
next >
Wrap
Text File
|
1992-09-28
|
15KB
|
544 lines
% $Id: docstrip.tex,v 1.1 91/09/08 03:53:12 gvr Exp $
%
%% This is file `docstrip.tex' generated
%% on <1991/2/1> with the docstrip utility (v1.1l test).
%%
%% The original source file was `docstrip.doc'.
%% Included modules: `stats'.
%%
%% IMPORTANT NOTICE:
%% You are not allowed to distribute this file.
%% For distribution of the original source see
%% the copyright notice in the file `docstrip.doc'.
%%
\def\filename{docstrip}
\def\fileversion{v1.1l test}
\def\filedate{90/12/10}
\def\docdate {90/06/15}
%% \CheckSum{835}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
\nofiles
\makeatletter
%% correcting a LaTeX bug first...
\def\@xtypein[#1]#2{\typeout{#2}\read\sixt@@n to#1\ifx #1\@defpar
\def#1{}\else
\@iden{\expandafter\@strip\expandafter
#1#1\@gobble\@gobble} \@gobble\fi\@typein}
\typeout{LaTeX utility: `docstrip'
\fileversion\space <\filedate> (FMi)}
\typeout{English documentation
\@spaces\@spaces\space\space <\docdate> (FMi)}
\typeout{}
\typeout{**********************************************************}
\typeout{* This program converts documented macro-files into fast *}
\typeout{* loadable files by stripping of (nearly) all comments!
\space*}
\typeout{**********************************************************}
\typeout{}
\def\test@batchfile{%
\ifx\undefined\batchfile
\let\batchfile\default@batchfile
\@okaytrue \else \@okayfalse \fi
\openin\batch@stream \batchfile\relax
\ifeof\batch@stream
\if@okay \else
\typeout{*************************************************}
\typeout{* Could not find your \string\batchfile=\batchfile}
\typeout{* Try to continue without it}
\typeout{*************************************************}
\fi
\else
\if@okay
\typeout{*************************************************}
\typeout{* Batch file docstrip.cmd found. Use it ? (y/n) *}
\typein[\answer]
{*************************************************}
\def\@tempa{y}%
\else \let\answer\@tempa \fi
\ifx\@tempa\answer \process@batchfile \fi
\fi}
\def\ask@questions{%
\typeout{}
\typeout{***************************************************}
\typeout{* First type the extension of your input file(s): *}
\typein[\infileext]
{***************************************************}
\typeout{}
\typeout{**************************************************}
\typeout{* Now type the extension of your output file(s): *}
\typein[\outfileext]
{**************************************************}
\typeout{}
\typeout{**************************************************}
\typeout{* Now give the name(s) of module(s) to include: \space *}
\typein[\includelist]
{**************************************************}
\typeout{}
\typeout{**************************************************}
\typeout{* Finally give the list of input file(s) without *}
\typeout{* extension separated by commas if necessary:\@spaces*}
\typein[\filelist]
{**************************************************}}
\newif\if@okay
\newread\@infile
\newread\@outfile
\def^^L{ }
\def\set@filenames{%
\edef\in@filename{\main@filename.\infileext}%
\edef\out@filename{\main@filename.\outfileext}}
\def\check@filenames{%
\ifx\infileext\outfilext
\typeout{}
\typeout{!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
\typeout{! Not possible to read from and write to the same file !}
\typeout{!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
\@okayfalse
\else
\@okaytrue
\immediate\openin\@infile \in@filename \relax
\ifeof \@infile
\@okayfalse
\typeout{}
\typeout{!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
\typeout{! Input file `\in@filename' not found !}
\typeout{!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
\else
\check@outfile
\fi
\immediate\closein\@infile
\fi}
\def\check@outfile{%
\immediate\openin\@outfile \out@filename \relax
\ifeof \@outfile \@okaytrue
\else
\@okayfalse
\typeout{}
\typeout{!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
\typeout{! Output file `\out@filename' already exists.}
\typeout{! Do you want to overwrite it? (yes/no)}
\typein[\answer]{!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
\def\@tempa{yes}%
\ifx\answer\@tempa \@okaytrue \fi
\fi
\immediate\closein\@outfile}
\def\write@postamble{%
\owrite{\string\endinput}%
\owrite{\double@percent}%
\owrite{\double@percent End of file `\out@filename'.}%
\immediate\closeout\@outfile}
\newcount\numberof@files
\newcount\meta@comment
\newcount\normal@comment
\newcount\code@line
\newcount\processed@line
\newcount\summeta@comment
\newcount\sumnormal@comment
\newcount\sumcode@line
\newcount\sumprocessed@line
\def\process@line{%
\advance\processed@line\@ne
\futurelet\next\process@@line}
\begingroup
\catcode`\*=12
\lccode`\*=`\%
\lowercase{%
\gdef\double@percent{** }
\gdef\percent@{*}
\gdef\process@@line{%
\if*\next
\expandafter\check@second
\else
\advance\code@line\@ne
\endlast@module
\expandafter\put@line
\fi}
\gdef\check@@second{%
\if*\next
\advance\meta@comment\@ne
\endlast@module
\let\next\put@line
\else
\if<\next
\let\next\check@module
\else
\advance\normal@comment\@ne
\endlast@module
\let\next\remove@line
\fi
\fi
\next}
}
\endgroup
\gdef\check@second#1{\futurelet\next\check@@second}
\def\check@module<{\futurelet\next\check@@module}
\def\check@@module{%
\if+\next
\let\next\plus@module
\else
\if-\next
\let\next\minus@module
\else
\if*\next
\let\next\star@module
\else
\if/\next
\let\next\slash@module
\else
\advance\normal@comment\@ne
\endlast@module
\let\next\remove@line
\fi
\fi
\fi
\fi
\next}
\def\module@included#1#2{%
\ifin@line@module
\def\@tempa{#1#2}%
\ifx\@tempa\curr@module \else
\maybe@message{>}\in@line@modulefalse \module@included#1{#2}\fi
\else
\in@line@moduletrue
\def\curr@module{#1#2}%
\maybe@message{<#1#2}%
\inclcurr@modulefalse
\@for\@tempa:=#2\do
{\edef\@tempb{\noexpand\in@{\@tempa,}{\includelist,}}%
\@tempb \ifin@ \inclcurr@moduletrue \fi}%
\fi
}
\def\endlast@module{%
\ifin@line@module
\maybe@message{>}\in@line@modulefalse \fi}
\newif\ifin@line@module
\newif\ifinclcurr@module
\def\plus@module+#1>{%
\module@included+{#1}%
\ifinclcurr@module
\advance\code@line\@ne
\expandafter\put@module
\else
\advance\normal@comment\@ne
\expandafter\remove@line
\fi}
\newif\ifoutput@block \output@blocktrue
\newif\ifin@block
\def\star@module*#1>{%
\ifin@block
\errmessage{Already in block <\block@type>}%
\else
\in@blocktrue
\def\block@type{*#1}%
\module@included*{#1}%
\in@line@modulefalse
\ifinclcurr@module
\output@blocktrue
\else
\output@blockfalse
\fi
\fi
\advance\normal@comment\@ne
\remove@line
}
\def\slash@module/#1>{%
\ifin@block
\in@blockfalse
\output@blocktrue
\maybe@message{\perc